<template>
  <div class="not-found-page">
    <div class="not-found-container">
      <div class="not-found-content">
        <!-- 404图标 -->
        <div class="error-icon">
          <div class="number">4</div>
          <div class="circle">
            <div class="inner-circle"></div>
          </div>
          <div class="number">4</div>
        </div>
        
        <!-- 错误信息 -->
        <h1 class="error-title">页面不存在</h1>
        <p class="error-description">
          抱歉，您访问的页面不存在或已被移除。
        </p>
        
        <!-- 建议操作 -->
        <div class="error-suggestions">
          <h3>您可以尝试：</h3>
          <ul>
            <li>检查URL地址是否正确</li>
            <li>返回首页重新导航</li>
            <li>使用菜单栏进行导航</li>
            <li>联系我们获取帮助</li>
          </ul>
        </div>
        
        <!-- 操作按钮 -->
        <div class="error-actions">
          <a-button type="primary" size="large" @click="goHome">
            <home-outlined />
            返回首页
          </a-button>
          <a-button size="large" @click="goBack">
            <arrow-left-outlined />
            返回上页
          </a-button>
          <a-button size="large" @click="refresh">
            <reload-outlined />
            刷新页面
          </a-button>
        </div>
        
        <!-- 快捷导航 -->
        <div class="quick-navigation">
          <h3>快捷导航</h3>
          <div class="nav-cards">
            <div class="nav-card" @click="navigateTo('home')">
              <home-outlined />
              <span>首页</span>
            </div>
            <div class="nav-card" @click="navigateTo('about')">
              <info-circle-outlined />
              <span>关于</span>
            </div>
            <div class="nav-card" @click="navigateTo('features')">
              <star-outlined />
              <span>功能展示</span>
            </div>
            <div class="nav-card" @click="navigateTo('communication')">
              <message-outlined />
              <span>通信测试</span>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 装饰元素 -->
      <div class="decorative-elements">
        <div class="floating-element element-1"></div>
        <div class="floating-element element-2"></div>
        <div class="floating-element element-3"></div>
        <div class="floating-element element-4"></div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import {
  HomeOutlined,
  ArrowLeftOutlined,
  ReloadOutlined,
  InfoCircleOutlined,
  StarOutlined,
  MessageOutlined
} from '@ant-design/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push({ name: 'home' })
}

const goBack = () => {
  if (window.history.length > 1) {
    router.go(-1)
  } else {
    goHome()
  }
}

const refresh = () => {
  window.location.reload()
}

const navigateTo = (routeName) => {
  router.push({ name: routeName })
}
</script>

<style scoped>
.not-found-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.not-found-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 60px 40px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

.not-found-content {
  text-align: center;
}

.error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  font-size: 120px;
  font-weight: bold;
  color: #1890ff;
}

.error-icon .number {
  opacity: 0.8;
}

.circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(45deg, #1890ff, #722ed1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 20px;
  animation: pulse 2s infinite;
}

.inner-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: white;
  position: relative;
}

.inner-circle::before {
  content: '?';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  color: #1890ff;
  font-weight: bold;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(24, 144, 255, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(24, 144, 255, 0);
  }
}

.error-title {
  font-size: 48px;
  color: #2c3e50;
  margin-bottom: 16px;
  font-weight: 700;
}

.error-description {
  font-size: 18px;
  color: #666;
  margin-bottom: 40px;
  line-height: 1.6;
}

.error-suggestions {
  text-align: left;
  margin-bottom: 40px;
  background: #f8f9fa;
  padding: 24px;
  border-radius: 12px;
  border-left: 4px solid #1890ff;
}

.error-suggestions h3 {
  color: #2c3e50;
  margin-bottom: 16px;
  font-size: 18px;
}

.error-suggestions ul {
  margin: 0;
  padding-left: 20px;
}

.error-suggestions li {
  color: #666;
  margin: 8px 0;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.quick-navigation {
  margin-top: 40px;
}

.quick-navigation h3 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 18px;
}

.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.nav-card:hover {
  background: #e6f7ff;
  border-color: #1890ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.15);
}

.nav-card .anticon {
  font-size: 24px;
  color: #1890ff;
  margin-bottom: 8px;
}

.nav-card span {
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.decorative-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.floating-element {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.element-1 {
  width: 60px;
  height: 60px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.element-2 {
  width: 80px;
  height: 80px;
  top: 20%;
  right: 10%;
  animation-delay: 1s;
}

.element-3 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  left: 15%;
  animation-delay: 2s;
}

.element-4 {
  width: 40px;
  height: 40px;
  bottom: 10%;
  right: 20%;
  animation-delay: 3s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-20px) rotate(120deg);
  }
  66% {
    transform: translateY(10px) rotate(240deg);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .not-found-container {
    padding: 40px 20px;
    margin: 20px;
  }
  
  .error-icon {
    font-size: 80px;
  }
  
  .circle {
    width: 80px;
    height: 80px;
    margin: 0 10px;
  }
  
  .inner-circle {
    width: 40px;
    height: 40px;
  }
  
  .inner-circle::before {
    font-size: 20px;
  }
  
  .error-title {
    font-size: 32px;
  }
  
  .error-description {
    font-size: 16px;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .nav-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .error-icon {
    font-size: 60px;
    flex-direction: column;
    gap: 10px;
  }
  
  .circle {
    margin: 0;
  }
  
  .nav-cards {
    grid-template-columns: 1fr;
  }
}
</style>